﻿using HCQ2_Model.APPModel.ParamModel;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HCQ2_Model.APPModel.ParamModel;
using System.ComponentModel.DataAnnotations;

namespace HCQ2_Model
{
    /// <summary>
    ///  当前位置
    /// </summary>
    public class CurrentPointModel: BaseAPI
    {
        public int cp_id { get; set; }
        public int user_id { get; set; }
        public string user_name { get; set; }
        [Required(ErrorMessage = "file_id：作品体验id必填项")]
        public int file_id { get; set; }
        public string file_name { get; set; }
        [Required(ErrorMessage = "folder_name：体验项目必填项")]
        public string folder_name { get; set; }
        [Required(ErrorMessage = "out_date：退出时间必填项")]
        public string out_date { get; set; }
        public decimal? x_place { get; set; }
        public decimal? y_place { get; set; }
        public decimal? z_place { get; set; }
        public T_VRCurrentPoint ToEntity()
        {
            return new T_VRCurrentPoint
            {
                user_id = this.user_id,
                user_name = this.user_name,
                file_id = this.file_id,
                file_name = this.file_name,
                folder_name = this.folder_name,
                out_date = DateTime.ParseExact(this.out_date, "yyyyMMddHHmmss", CultureInfo.CurrentCulture, DateTimeStyles.None),
                x_place = this.x_place,
                y_place = this.y_place,
                z_place = this.z_place
            };
        }
    }
    public partial class T_VRCurrentPoint
    {
        public CurrentPointModel ToPOCO()
        {
            return new CurrentPointModel
            {
                cp_id = this.cp_id,
                user_id = this.user_id,
                user_name = this.user_name,
                file_id = this.file_id,
                file_name = this.file_name,
                folder_name = this.folder_name,
                out_date = this.out_date.ToString("yyyy-MM-dd HH:mm"),
                x_place = this.x_place,
                y_place = this.y_place,
                z_place = this.z_place
            };
        }
    }
}
